package net.bolue.sysmng.tblbean;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;


/**
 * 删除基本资源
 * @author Administrator
 *
 */
public class DelRes extends TableBean{

	/**
	 * 子系统
	 */
	private String subSys;
	
	/**
	 * 删除标识
	 */
	private String deleteId;
	
	/**
	 * 删除类型
	 * 1,直接数据表操作
	 * 2，数据表映射类操作
	 */
	private Integer deleteType;
	
	/**
	 * 描述
	 */
	private String resDesc;
	
	/**
	 * 更新对象
	 */
	private String resObj;
	
	/**
	 * 备注
	 */
	private String remark;

	public String getSubSys() {
		return subSys;
	}

	public void setSubSys(String subSys) {
		this.subSys = subSys;
	}

	public String getDeleteId() {
		return deleteId;
	}

	public void setDeleteId(String deleteId) {
		this.deleteId = deleteId;
	}

	public Integer getDeleteType() {
		return deleteType;
	}

	public void setDeleteType(Integer deleteType) {
		this.deleteType = deleteType;
	}

	public String getResDesc() {
		return resDesc;
	}

	public void setResDesc(String resDesc) {
		this.resDesc = resDesc;
	}

	public String getResObj() {
		return resObj;
	}

	public void setResObj(String resObj) {
		this.resObj = resObj;
	}
	
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Override
	public TableBean mapToEntry(Map<String, Object> map) {
		DelRes delRes = new DelRes();
		Set<String> keySet = map.keySet();
		Iterator<String> keyIt = keySet.iterator();
		while(keyIt.hasNext()){
			String key = keyIt.next();
			Object o = map.get(key);
			if("SUBSYS".equals(key)){
				delRes.setSubSys((String)o);
			} else if("DELETEID".equals(key)){
				delRes.setDeleteId((String)o);
			} else if("DELTYPE".equals(key)){
				delRes.setDeleteType((Integer)o);
			} else if("RESDESC".equals(key)){
				delRes.setResDesc((String)o);
			} else if("RESOBJ".equals(key)){
				delRes.setResObj((String)o);
			} else if("REMARK".equals(key)){
				delRes.setRemark((String)o);
			}
		}
		return delRes;
	}

	@Override
	public String keyProps() {
		return "SUBSYS,DELETEID";
	}
	
	public String getTableName(){
		String tableName = "";
		if(this.deleteType==1){
			tableName = this.resObj;
		}
		return tableName;
	}
	
}
